# -*- coding: utf-8 -*-

__Author__ = 'By: ざ凍結の→愛\nQQ: 892768447\nEmail: 892768447@qq.com'
__Copyright__ = 'Copyright (c) 2013 ざ凍結の→愛'
__Version__ = 'Version 1.0'

from android import Android
from threading import Thread,_sleep

droid = Android()

'''
#1.创建弹出框
droid.dialogCreateAlert('标题', '消息内容')
droid.dialogSetNegativeButtonText('确认')
droid.dialogSetNeutralButtonText('00')
droid.dialogSetPositiveButtonText('取消')
droid.dialogShow()
result = droid.dialogGetResponse().result
print result
if result.get('canceled'):
  print '按下返回键取消显示'
else:
  print result.get('which')
'''

'''
#2.1系统默认输入框
result = droid.dialogGetInput('标题','请输入','默认值').result
print result
#None#按下返回键和cancel得到None
#默认值#按下ok键
'''

'''
#2.2自定义输入框
droid.dialogCreateInput('标题', '请输入内容', '默认内容', None)
#最后一个参数为限制输入的类型
#number数字 text字符
droid.dialogSetNegativeButtonText('确认')
droid.dialogSetPositiveButtonText('取消')
droid.dialogShow()
result = droid.dialogGetResponse().result
print result
if result.get('canceled'):
  print '按下返回键取消显示'
else:
  if result.get('which') == 'positive':
    print '按下确定按钮'
    print result.get('value')#输出值
'''
#创建密码输入框与上面类似

'''
#3.1横向进度条
droid.dialogCreateHorizontalProgress('标题', '消息', 100)
droid.dialogShow()
#更改进度条最大值
#droid.dialogSetMaxProgress(200)
for i in range(100):
  #设置进度值
  droid.dialogSetCurrentProgress(i)
  _sleep(0.1)
droid.dialogDismiss()
'''

'''
#3.2圆形进度条
#后面最大值100没用
droid.dialogCreateSpinnerProgress('标题', '消息', 100)
droid.dialogShow()
_sleep(10)
droid.dialogDismiss()
#这句话必须调用,取消显示。否则屏幕失去焦点
'''

'''
#4SeekBar滑动块
def event():
  while True:
    print droid.eventWait()

droid.dialogCreateSeekBar(0,100,'title','message')
#参数说明 0-起始位置 100-最大值
droid.dialogShow()
Thread(target=event).start()
'''

'''
#5.1单击Item列表框
droid.dialogCreateAlert('title','message')
#message无效
droid.dialogSetItems(['1','2','3','4','5'])
droid.dialogShow()
#要捕获选中事件需要监听eventWait函数
'''

'''
#5.2 单选Item列表框
def event():
  while True:
    result = droid.eventWait().result
    if result['data'].get('which') == 'positive':
      #按下确定键
      print droid.dialogGetSelectedItems()
      #获取之前选择的某一项

droid.dialogCreateAlert('title','message')
#message无效
droid.dialogSetSingleChoiceItems(['1','2','3','4','5'],0)
参数 数组 0为默认选中的位置
droid.dialogSetPositiveButtonText('确定')
droid.dialogShow()

Thread(target=event).start()
'''

'''
#5.3 单选Item列表框
def event():
  while True:
    result = droid.eventWait().result
    if result['data'].get('which') == 'positive':
      #按下确定键
      print droid.dialogGetSelectedItems()
      #获取之前选择的某几项

droid.dialogCreateAlert('title','message')
#message无效
droid.dialogSetMultiChoiceItems(['1','2','3','4','5'],[0,1])
参数 数组 [0,1]为默认选中的几个位置
droid.dialogSetPositiveButtonText('确定')
droid.dialogShow()

Thread(target=event).start()
'''
